import { HttpClient,HttpErrorResponse} from '@angular/common/http';
import { catchError, retry } from 'rxjs/operators';
import { Injectable } from '@angular/core';
import { Observable , of} from 'rxjs';
import { SelectItemGroup} from 'primeng/api';
import { NgxhttpService } from '../../@core/utils/ngxhttp.service';
import { Router } from '@angular/router';
import { NbTokenService } from '@nebular/auth';
@Injectable()
export class AdcdService extends NgxhttpService{
  configUrl = 'assets/pages/main/provincecitycountyselectitem.json';
  constructor(private http: HttpClient,
    tokenService: NbTokenService,
    router : Router) {
  super(tokenService, router);
  }
  getProvinceCityCountySelectItem():Observable<SelectItemGroup[]>{
    console.log(1);
    return this.http.get<SelectItemGroup[]>(this.configUrl).pipe(
      retry(1), // retry a failed request up to 3 times
      catchError((error: HttpErrorResponse) =>
        this.handleError(error)
      ) // then handle the error
    );
  }
}
